package info.techgeek.labs.java5Features.thread.blcQueing;

import java.util.concurrent.BlockingQueue;

public class WidgerFurmuzzitSalesman implements Runnable {
	  private BlockingQueue<WidgerFurmuzzit> queue;
	  public WidgerFurmuzzitSalesman(BlockingQueue<WidgerFurmuzzit> queue) {
	    this.queue = queue;
	  }
	  
	  public void run() {
	     try {
	        while(true) {
	     	
	     	 WidgerFurmuzzit futurePet = queue.take(); // will wait for groomer!
	     	 sell(futurePet);
		}	
	     }
	     catch(InterruptedException e) {
	       // ahhh fooey.
	     }
	  }
	     private void sell(WidgerFurmuzzit petToSell) {
	       // spend time selling here...
	     }
	 
//	// some main method somewhere
//	public static void main(String[] args) {
//	 BlockingQueue<WidgerFurmuzzit> queue = // ... build queue here!
//	 Thread a = new Thread(new WidgerFurmuzzitScientist(queue));
//	 Thread b = new Thread(new WidgerFurmuzzitSalesman(queue));
//	 a.start();
//	 b.start(); 
//	}
	}

